package com.suncnpap.library.service.impl;

import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.app.util.database.mybatis.Page;
import com.suncnpap.library.service.BorrowBookRecordService;
import com.suncnpap.library.mapper.BorrowBookRecordMapper;
import com.suncnpap.library.model.BorrowBook;
import com.suncnpap.library.model.BorrowBookInfo;
import com.suncnpap.library.model.BorrowBookRecord;

/** 
 * 说明： 图书借阅记录Service实现类
 * @version
 */
@Service("borrowBookRecordService")
public class BorrowBookRecordServiceImpl implements BorrowBookRecordService{

	
	@Autowired
	BorrowBookRecordMapper borrowBookRecordMapper;
	
	@Override
	public void add(BorrowBookRecord obj) {
		// TODO Auto-generated method stub
		borrowBookRecordMapper.add(obj);
	}

	@Override
	public void update(BorrowBookRecord obj) {
		// TODO Auto-generated method stub
		borrowBookRecordMapper.edit(obj);
	}

	@Override
	public void deleteById(String strId) {
		// TODO Auto-generated method stub
		borrowBookRecordMapper.deleteById(strId);
		
	}
	@Override
	public void deleteMore(String[] strIds) {
		// TODO Auto-generated method stub
		borrowBookRecordMapper.deleteMore(strIds);
	}

	@Override
	public Page list(Page page) {
		// TODO Auto-generated method stub
		List<BorrowBookRecord> list = borrowBookRecordMapper.datalistPage(page);
		page.setDataList(list);
		return page;
	}


	@Override
	public int findCount(Page page) {
		// TODO Auto-generated method stub
		return borrowBookRecordMapper.findCount(page);
	}
	@Override
	public BorrowBookRecord findById(String strId) {
		// TODO Auto-generated method stub
		return borrowBookRecordMapper.findById(strId);
	}
	
	@Override
	public BorrowBookRecord findByBookBarcode(String strBookBarcode, String strSchoolId){
		return borrowBookRecordMapper.findByBookBarcode(strBookBarcode, strSchoolId);
	}

	@Override
	public Page listInfo(Page page) {
		// TODO Auto-generated method stub
		List<BorrowBookInfo> list = borrowBookRecordMapper.dataInfolistPage(page);
		page.setDataList(list);
		return page;
	}
	
	@Override
	public Page readerBorrowList(Page page) {
		// TODO Auto-generated method stub
		List<BorrowBookInfo> list = borrowBookRecordMapper.readerborrowlistPage(page);
		page.setDataList(list);
		return page;
	}
	
	@Override
	public Page libraryBorrowList(Page page) {
		// TODO Auto-generated method stub
		List<BorrowBookInfo> list = borrowBookRecordMapper.libraryborrowlistPage(page);
		page.setDataList(list);
		return page;
	}

	@Override
	public  void addList(List<BorrowBookRecord> objList){
		if(objList!=null && objList.size()>0){
			for(BorrowBookRecord reader:objList){
				if(reader!=null){
					borrowBookRecordMapper.add(reader);
				}
			}
		}
		
	}
	
	@Override
	public Page readerBorrowGroupList(Page page){
		List<BorrowBookInfo> list = borrowBookRecordMapper.readerBorrowGroupList(page);
		page.setDataList(list);
		return page;
	}
	
	@Override
	public BorrowBookInfo libraryBorrowStatistics(Page page){
		BorrowBookInfo obj = borrowBookRecordMapper.libraryBorrowStatistics(page);
		return obj;
	}
	
	@Override
	public Page hourBorrowStatistics(Page page){
		List<BorrowBookInfo> list = borrowBookRecordMapper.hourBorrowStatistics(page);
		page.setDataList(list);
		return page;
	}
}

